package com.kim.smartring.net.entity;

import org.json.JSONObject;

import android.content.Context;
import android.util.Log;

import com.kim.smartring.net.IReceiverListener;

public class UpdateDeviceBindingEntity extends BaseEntity {

	private static final String TAG = "UpdateDeviceBindingEntity";

	private String uid;
	private String deviceId;

	public UpdateDeviceBindingEntity(Context context,
			IReceiverListener receiverListener) {
		super(context, receiverListener);
	}

	public UpdateDeviceBindingEntity(Context context, String uid,
			String deviceId, IReceiverListener receiverListener) {
		super(context, receiverListener);
		this.uid = uid;
		this.deviceId = deviceId;
	}

	@Override
	protected void init() {
		this.url = URLConstant.URL_UPDATE_DEVICE_BINDING;
	}

	@Override
	public String getSendData() {
		return generateSendData();
	}

	private String generateSendData() {
		JSONObject jsonObject = new JSONObject();
		String sendData = null;
		try {
			jsonObject.put("userId", uid);
			jsonObject.put("deviceId", deviceId);
			sendData = jsonObject.toString();
			Log.d(TAG,
					String.format("updateDeviceBinding send data:$s", sendData));
		} catch (Exception e) {
			e.printStackTrace();
		} finally {
			jsonObject = null;
		}
		return sendData;
	}

	/*
	 * { 　　“userId”:”UserId”, 　　“deviceId”:”设备号” }
	 */
}
